# -*- coding:utf-8 -*-

from django.db import models
from Apps.common.custommodel import CustomModel
from Apps.user.models import User


class Project(CustomModel):
    project_name = models.CharField(max_length=30, verbose_name='项目名称')
    project_type = models.CharField(max_length=4, verbose_name='项目类型(web,app)')
    project_version = models.CharField(max_length=30, verbose_name='项目版本')
    project_tags = models.TextField(verbose_name='项目标签')
    project_url = models.TextField(verbose_name='项目基础URL')
    project_description = models.CharField(default='', max_length=50, verbose_name='项目描述')
    is_delete = models.CharField(null=True, blank=True, max_length=4, default='0',
                                 verbose_name='是否删除(0 未删 , 1-已删除(放入回收站))')
    project_manager = models.CharField(null=True, blank=True, max_length=50, default='', verbose_name='项目管理员')
    project_collaborator = models.TextField(null=True, blank=True, default='',
                                            verbose_name='项目协作人，列表展示[user_id,,]')
    project_setting = models.TextField(default='', verbose_name='项目公共设置')
    project_params = models.TextField(default='', verbose_name='项目公共请求参数')
    project_headers = models.TextField(default='', verbose_name='项目公共请求头')
    project_cookies = models.TextField(default='', verbose_name='项目公共cookies')
    project_Auth = models.TextField(default='', verbose_name='项目公共验证')
    creator = models.ForeignKey(User, on_delete=models.DO_NOTHING, related_name="project_c", db_constraint=False,
                                verbose_name="创建人")
    modifier = models.ForeignKey(User, on_delete=models.DO_NOTHING, related_name="project_m", db_constraint=False,
                                 verbose_name="修改人")

    class Meta:
        db_table = "project"
        verbose_name = "项目表"
        ordering = ('-create_time',)

    def __str__(self):
        return self.project_name


"""

class Project(CustomModel):
    project_name = models.CharField(max_length=30, verbose_name='项目名称')
    project_type = models.CharField(max_length=4, verbose_name='项目类型(web,app)')
    project_version = models.CharField(max_length=30, verbose_name='项目版本')
    project_tags = models.TextField(verbose_name='项目标签')
    project_url = models.TextField(verbose_name='项目基础URL')
    project_description = models.CharField(default='', max_length=50, verbose_name='项目描述')
    is_delete = models.CharField(null=True, blank=True, max_length=4, default='0',
                                 verbose_name='是否删除(0 未删 , 1-已删除(放入回收站))')
    project_manager = models.CharField(null=True, blank=True, max_length=50, default='', verbose_name='项目管理员')
    project_collaborator = models.TextField(null=True, blank=True, default='',
                                            verbose_name='项目协作人，列表展示[user_id,,]')
    project_setting = models.TextField(default='', verbose_name='项目公共设置')
    project_params = models.TextField(default='', verbose_name='项目公共请求参数')
    project_headers = models.TextField(default='', verbose_name='项目公共请求头')
    project_cookies = models.TextField(default='', verbose_name='项目公共cookies')
    project_Auth = models.TextField(default='', verbose_name='项目公共验证')
    creator = models.ForeignKey(User, on_delete=models.DO_NOTHING, related_name="project_c", db_constraint=False,
                                verbose_name="创建人")
    modifier = models.ForeignKey(User, on_delete=models.DO_NOTHING, related_name="project_m", db_constraint=False,
                                 verbose_name="修改人")

    class Meta:
        db_table = "project"
        verbose_name = "项目表"
        ordering = ('-create_time',)

    def __str__(self):
        return self.project_name
"""